package com.content;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

public class DoctorTime {

    public static List<Date> timeList;

    static {
        timeList = new ArrayList<>();

        Calendar now = Calendar.getInstance();
        now.set(Calendar.SECOND, 0);
        now.set(Calendar.MINUTE, 0);
        now.set(Calendar.HOUR_OF_DAY, 0);

        Calendar t1 = (Calendar) now.clone();
        t1.set(Calendar.HOUR_OF_DAY, 8);
        Calendar t2 = (Calendar) now.clone();
        t2.set(Calendar.HOUR_OF_DAY, 10);
        Calendar t3 = (Calendar) now.clone();
        t3.set(Calendar.HOUR_OF_DAY, 14);
        Calendar t4 = (Calendar) now.clone();
        t4.set(Calendar.HOUR_OF_DAY, 16);

        Calendar tor = (Calendar) now.clone();
        tor.add(Calendar.DATE, 1);

        Calendar t5,t6,t7,t8;
        t5 = (Calendar) tor.clone();
        t5.set(Calendar.HOUR_OF_DAY, 8);

        t6 = (Calendar) tor.clone();
        t6.set(Calendar.HOUR_OF_DAY, 10);

        t7 = (Calendar) tor.clone();
        t7.set(Calendar.HOUR_OF_DAY, 14);

        t8 = (Calendar) tor.clone();
        t8.set(Calendar.HOUR_OF_DAY, 16);


        timeList.add(t1.getTime());
        timeList.add(t2.getTime());
        timeList.add(t3.getTime());
        timeList.add(t4.getTime());
        timeList.add(t5.getTime());
        timeList.add(t6.getTime());
        timeList.add(t7.getTime());
        timeList.add(t8.getTime());
    }

    public static List<Date> getTimeList(){
        return timeList.stream().filter(date -> date.compareTo(Calendar.getInstance().getTime()) > 0).collect(Collectors.toList());
    }
}
